Skip to content

Comments

Setting/#9 Logger#16

Merged
y-eonee merged 4 commits intodevelopfrom
setting/#9-logger
Jan 8, 2026
Merged

Setting/#9 Logger#16
y-eonee merged 4 commits intodevelopfrom
setting/#9-logger

Conversation

@y-eonee
Copy link
Contributor

@y-eonee y-eonee commented Jan 7, 2026

🔗 연결된 이슈

📄 작업 내용

  • CherrishLogger를 만들었습니다.
  • CherrishLogger.debug, .network, .data, .error ~~ 요렇게 쓰면 돼요
image

💻 주요 코드 설명

enum LogType {
    case network // 네트워크
    case debug // 디버깅
    case data // 서버에서 준 데이터
    case error(error: Error) // 에러
}

📚 참고자료

https://ios-development.tistory.com/381

@y-eonee y-eonee requested a review from a team January 7, 2026 15:18
@y-eonee y-eonee self-assigned this Jan 7, 2026
@y-eonee y-eonee requested review from soseoyo12, sum130 and wotjs020708 and removed request for a team January 7, 2026 15:18
@y-eonee y-eonee added 나연🐹 Setting 프로젝트 세팅 시 사용 labels Jan 7, 2026
@y-eonee y-eonee linked an issue Jan 7, 2026 that may be closed by this pull request
1 task
@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

프로젝트에 OSLog.framework를 추가하고 수동 코드 서명으로 설정을 변경했으며, 중앙화된 로깅(CherrishLogger)과 오류형(CherrishError)을 도입하고 TestViewModel의 print 호출을 새 로거로 교체했습니다.

Changes

Cohort / File(s) 변경 요약
Xcode 프로젝트 설정
Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj
OSLog.framework 참조 및 Frameworks 그룹 추가. 코드 서명 스타일을 Automatic→Manual로 변경하고 CODE_SIGN_IDENTITY, DEVELOPMENT_TEAM, PROVISIONING_PROFILE_SPECIFIER의 SDK/구성별 항목 추가/수정.
핵심 유틸리티 추가
Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift, Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift
CherrishError enum 추가(여러 오류 케이스 및 한글 errorDescription). CherrishLogger 도입: OSLog 확장, LogType enum, 환경(디버그/릴리스) 기반 출력 제어 및 static 로그 API 추가.
로거 통합
Cherrish-iOS/Cherrish-iOS/Presentation/Feature/TestViewModel.swift
print("view model execute")CherrishLogger.debug("로거 테스트")로 교체.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant ViewModel
    participant CherrishLogger
    participant OSLogFramework as OSLog

    ViewModel->>CherrishLogger: debug("로거 테스트")
    activate CherrishLogger
    CherrishLogger->>CherrishLogger: format message (timestamp, file, func)
    alt Debug mode or allowed in release
        CherrishLogger->>OSLog: os_log(message, level)
    else Suppressed in release
        note right of CherrishLogger `#fef3c7`: 로그 출력 생략
    end
    deactivate CherrishLogger
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45분

Possibly related PRs

  • Setting/#1 프로젝트 세팅 #4: 이전에 빈 CherrishLogger.swift와 초기 project.pbxproj 스캐폴딩을 추가한 PR로, 이번 변경의 구현 및 프로젝트 파일 수정과 강한 연관성 있음.

Suggested reviewers

  • wotjs020708
  • sum130
  • soseoyo12
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning 프로젝트 파일 서명 설정 변경이 로깅 기능 구현과 무관하며 이슈 요구사항 외 범위입니다. 서명 설정 변경(CODE_SIGN_STYLE, CODE_SIGN_IDENTITY, PROVISIONING_PROFILE_SPECIFIER)을 별도 PR로 분리하거나, 해당 변경이 필요한 경우 이슈에 문서화하세요.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경사항인 CherrishLogger 구현을 명확하게 요약하고 있습니다.
Description check ✅ Passed 설명이 CherrishLogger 구현, 사용 방법, LogType 정의 등 변경사항과 관련된 내용을 포함하고 있습니다.
Linked Issues check ✅ Passed CherrishError, CherrishLogger, LogType 구현으로 이슈 #9의 구조화된 로깅 시스템 요구사항을 충족합니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch setting/#9-logger

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Fix all issues with AI agents
In @Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj:
- Around line 280-286: The project file now forces manual signing
(CODE_SIGN_STYLE = Manual) and sets specific signing keys
(CODE_SIGN_IDENTITY[sdk=iphoneos*], DEVELOPMENT_TEAM,
"DEVELOPMENT_TEAM[sdk=iphoneos*]") and development asset paths; revert to a
team-agnostic, CI-friendly setup by either restoring CODE_SIGN_STYLE = Automatic
and clearing DEVELOPMENT_TEAM/PROVISIONING entries or, if manual signing is
required, document and commit instructions to ensure every developer and CI has
the named provisioning profile (cherrish-development) and certificate installed;
update project.pbxproj to remove hardcoded team IDs and provisioning settings or
add commentary for maintainers and then verify by producing a short confirmation
that the change allows other devs and CI to build ([request_verification]).
- Around line 9-11: Remove the explicit OSLog.framework linking entries from the
Xcode project: delete the PBXBuildFile entry with id 5126F89F2F0E9AF000E67E33
(the "OSLog.framework in Frameworks" build file), remove the corresponding
PBXFileReference with id 5126F89E2F0E9AF000E67E33 (the OSLog.framework file
reference) and any references to that fileRef inside PBXFrameworksBuildPhase or
other sections (the other occurrences noted in the comment). OSLog is provided
by the SDK and only requires import OSLog in source; after removing those
entries ensure there are no dangling references and run a clean build to verify
the project still compiles successfully.

In @Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift:
- Around line 39-40: The case .unknownError in CherrishError.errorDescription
currently returns nil; change it to return a sensible default string (e.g., "알 수
없는 오류" or "Unknown error") so errorDescription never yields nil for
unknownError; update the switch in the errorDescription computed property for
the CherrishError enum to return that default message for the .unknownError
case.
- Line 10: The enum CherrishError is implicitly internal but should be exported;
change its declaration from "enum CherrishError: Error, LocalizedError,
Equatable" to "public enum CherrishError: Error, LocalizedError, Equatable" so
the type (and any public cases or members) is usable outside the module, and
update any nested members or associated values to appropriate access levels if
needed.

In @Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift:
- Line 18: LogType and CherrishLogger are currently implicitly internal and need
to be usable across the module boundary; change their declarations to public by
adding the public access modifier to the enum LogType and the CherrishLogger
type (and any related declarations at the other occurrence referenced) so they
are exported from the module; ensure any methods, initializers, or nested types
that must be accessed externally are also marked public as needed.
- Line 108: The current code sets fileName using the compiler literal (#file)
which always yields "CherrishLogger.swift"; change it to use the incoming file
parameter so the caller's filename is logged by replacing let fileName = (#file
as NSString).lastPathComponent with code that derives fileName from the function
parameter (e.g., let fileName = (file as NSString).lastPathComponent), and
ensure the variable 'fileName' is used downstream in the log output.
- Line 11: The static property subsystem currently force-unwraps
Bundle.main.bundleIdentifier (static let subsystem =
Bundle.main.bundleIdentifier!), which can crash in tests or environments without
a bundle identifier; change subsystem to safely unwrap with a fallback (e.g.,
use optional coalescing or a computed property that returns
Bundle.main.bundleIdentifier ?? "com.cherrish.unknown" or similar) so it never
force-unwraps and always provides a safe default value.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1ed994 and bc20d26.

📒 Files selected for processing (4)
  • Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj
  • Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift
  • Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift
  • Cherrish-iOS/Cherrish-iOS/Presentation/Feature/TestViewModel.swift
🧰 Additional context used
🧬 Code graph analysis (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Feature/TestViewModel.swift (1)
Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift (1)
  • debug (131-137)
🔇 Additional comments (3)
Cherrish-iOS/Cherrish-iOS/Presentation/Feature/TestViewModel.swift (1)

21-21: print를 로거로 교체한 것은 좋습니다!

중앙화된 로깅 시스템을 사용하도록 변경한 것은 좋은 개선입니다. 이를 통해 로그 레벨, 카테고리, 타임스탬프를 일관되게 관리할 수 있습니다.

Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift (2)

86-91: DateFormatter를 static let으로 선언한 것은 좋은 최적화입니다.

DateFormatter 생성 비용이 높기 때문에 재사용하는 것은 성능상 좋은 선택입니다.


80-84: 릴리즈 모드에서 에러만 로깅하는 전략이 적절합니다.

프로덕션 환경에서는 에러만 로깅하고 디버그 로그를 제외하는 것은 성능과 프라이버시 측면에서 좋은 접근 방식입니다.

Comment on lines +280 to 286
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = CG37U6CMKP;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CG37U6CMKP;
ENABLE_PREVIEWS = YES;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

수동 코드 서명 설정을 확인하세요.

코드 서명 방식이 Automatic에서 Manual로 변경되었고, 개발 팀 및 프로비저닝 프로파일이 설정되었습니다. 이러한 변경사항은:

  • 다른 팀 멤버들의 로컬 빌드에 영향을 줄 수 있습니다
  • CI/CD 파이프라인 설정과 일치해야 합니다
  • 프로비저닝 프로파일(cherrish-development)이 모든 개발자의 Xcode에 설치되어 있어야 합니다

팀 전체가 동일한 프로비저닝 프로파일과 인증서에 액세스할 수 있는지 확인하세요.

Also applies to: 302-303

🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj around lines 280 - 286,
The project file now forces manual signing (CODE_SIGN_STYLE = Manual) and sets
specific signing keys (CODE_SIGN_IDENTITY[sdk=iphoneos*], DEVELOPMENT_TEAM,
"DEVELOPMENT_TEAM[sdk=iphoneos*]") and development asset paths; revert to a
team-agnostic, CI-friendly setup by either restoring CODE_SIGN_STYLE = Automatic
and clearing DEVELOPMENT_TEAM/PROVISIONING entries or, if manual signing is
required, document and commit instructions to ensure every developer and CI has
the named provisioning profile (cherrish-development) and certificate installed;
update project.pbxproj to remove hardcoded team IDs and provisioning settings or
add commentary for maintainers and then verify by producing a short confirmation
that the change allows other devs and CI to build ([request_verification]).


import Foundation

enum CherrishError: Error, LocalizedError, Equatable {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

접근 제어자를 명시하세요.

이 에러 타입이 프로젝트 전체에서 사용될 것으로 보이므로, public enum CherrishError로 명시적으로 선언하는 것이 좋습니다. 현재 암시적 internal 접근 제어는 모듈 외부에서 사용할 수 없습니다.

♻️ 제안하는 수정
-enum CherrishError: Error, LocalizedError, Equatable {
+public enum CherrishError: Error, LocalizedError, Equatable {
🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift at line 10, The enum
CherrishError is implicitly internal but should be exported; change its
declaration from "enum CherrishError: Error, LocalizedError, Equatable" to
"public enum CherrishError: Error, LocalizedError, Equatable" so the type (and
any public cases or members) is usable outside the module, and update any nested
members or associated values to appropriate access levels if needed.

static let error = OSLog(subsystem: subsystem, category: "Error")
}

enum LogType {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

LogType과 CherrishLogger의 접근 제어자를 명시하세요.

이 타입들이 프로젝트 전체에서 사용되므로 public으로 선언해야 합니다. 현재 암시적 internal 접근 제어는 모듈 외부에서 사용할 수 없습니다.

♻️ 제안하는 수정
-enum LogType {
+public enum LogType {
     case network
     case debug
     case data
     case error(error: Error)
     // ...
 }

-struct CherrishLogger {
+public struct CherrishLogger {
     // ...
 }

Also applies to: 71-71

🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift at line 18, LogType and
CherrishLogger are currently implicitly internal and need to be usable across
the module boundary; change their declarations to public by adding the public
access modifier to the enum LogType and the CherrishLogger type (and any related
declarations at the other occurrence referenced) so they are exported from the
module; ensure any methods, initializers, or nested types that must be accessed
externally are also marked public as needed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In @Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj:
- Line 10: The PBX file contains an explicit PBXFileReference for
OSLog.framework (the entry with name = OSLog.framework and path =
System/Library/Frameworks/OSLog.framework) and an associated Frameworks group
that are unnecessary; remove that PBXFileReference and any references to the
Frameworks group (the Frameworks group block that lists OSLog.framework and
related entries) from the project.pbxproj so OSLog is used via import OSLog only
and not explicitly linked in the project.

In @Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift:
- Around line 10-19: The enum CherrishError should be explicitly exported:
change the declaration of CherrishError to be public so it can be used across
the project (i.e., make the type public by updating the declaration for enum
CherrishError to include the public access modifier while keeping its existing
cases like DIFailedError, decodingError, URLError, networkRequestFailed,
networkConnect, networkError(code:message:), noData, unknownError, and
encodingError).

In @Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift:
- Line 11: The forced unwrap of Bundle.main.bundleIdentifier in the static let
subsystem constant is unsafe and can crash in tests or certain environments;
change the initializer for subsystem in CherrishLogger (static let subsystem) to
handle the optional safely — e.g., use nil-coalescing to a sensible default
identifier or fallback to another safe source
(Bundle.main.object(forInfoDictionaryKey: "CFBundleIdentifier") as? String ??
"com.cherrish.unknown"), or compute it lazily and guard-fail with a default, so
no forced unwrap remains.
- Around line 147-153: Change the static func error to accept an optional
message parameter (e.g., message: String = "") and pass that message into the
existing log call instead of the empty string; update the log handling for the
.error(error: Error) case inside log(...) to include and format both the
provided message and error.localizedDescription (so the log output shows the
custom context message plus the error details). Ensure you update the signature
of CherrishLogger.error and the .error case handling code paths that construct
the final log string.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc20d26 and 6843505.

📒 Files selected for processing (3)
  • Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj
  • Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift
  • Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift
🔇 Additional comments (6)
Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift (1)

21-42: LGTM!

errorDescription 구현이 잘 되어 있습니다. 모든 케이스에 대해 명확한 한국어 메시지를 제공하며, 이전 리뷰에서 지적된 unknownErrornil 반환 문제도 해결되었습니다.

Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift (5)

86-91: LGTM!

DateFormatterstatic let으로 선언하여 인스턴스를 재사용하는 것은 좋은 패턴입니다. en_US_POSIX locale 설정도 날짜 포맷 일관성을 보장합니다.


106-108: 파일명 로깅 버그가 수정되었습니다.

이전 리뷰에서 지적된 #file 대신 file 파라미터를 사용하도록 수정되었습니다. 이제 호출한 파일의 실제 이름이 로그에 정상적으로 표시됩니다.


123-145: LGTM!

network, debug, data 함수들이 일관된 시그니처로 잘 구현되어 있습니다. #file#function 기본값을 사용하여 호출 위치를 자동으로 캡처하는 패턴이 적절합니다.


71-71: CherrishLogger의 접근 제어자를 명시하세요.

프로젝트 전체에서 사용되는 로거이므로 public struct CherrishLogger로 명시적으로 선언하는 것이 좋습니다.

Likely an incorrect or invalid review comment.


18-18: LogType의 접근 제어자를 명시하세요.

이 타입이 다른 모듈에서 사용될 경우 public으로 선언해야 합니다.

Likely an incorrect or invalid review comment.

objects = {

/* Begin PBXFileReference section */
5126F89E2F0E9AF000E67E33 /* OSLog.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OSLog.framework; path = System/Library/Frameworks/OSLog.framework; sourceTree = SDKROOT; };
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

OSLog.framework 명시적 링크가 불필요합니다.

OSLog는 iOS 10부터 사용 가능한 시스템 프레임워크로, import OSLog만으로 사용할 수 있습니다. 프로젝트에 명시적으로 링크할 필요가 없으며, 이 참조와 관련된 Frameworks 그룹(lines 46-53)을 제거해도 됩니다.

🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj at line 10, The PBX file
contains an explicit PBXFileReference for OSLog.framework (the entry with name =
OSLog.framework and path = System/Library/Frameworks/OSLog.framework) and an
associated Frameworks group that are unnecessary; remove that PBXFileReference
and any references to the Frameworks group (the Frameworks group block that
lists OSLog.framework and related entries) from the project.pbxproj so OSLog is
used via import OSLog only and not explicitly linked in the project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지웠는데..;;

Comment on lines +10 to +19
enum CherrishError: Error, LocalizedError, Equatable {
case DIFailedError
case decodingError
case URLError
case networkRequestFailed
case networkConnect
case networkError(code: Int, message: String)
case noData
case unknownError
case encodingError
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

접근 제어자를 명시하세요.

이 에러 타입이 프로젝트 전체에서 사용될 것으로 보이므로, public enum CherrishError로 명시적으로 선언하는 것이 좋습니다.

♻️ 제안하는 수정
-enum CherrishError: Error, LocalizedError, Equatable {
+public enum CherrishError: Error, LocalizedError, Equatable {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
enum CherrishError: Error, LocalizedError, Equatable {
case DIFailedError
case decodingError
case URLError
case networkRequestFailed
case networkConnect
case networkError(code: Int, message: String)
case noData
case unknownError
case encodingError
public enum CherrishError: Error, LocalizedError, Equatable {
case DIFailedError
case decodingError
case URLError
case networkRequestFailed
case networkConnect
case networkError(code: Int, message: String)
case noData
case unknownError
case encodingError
🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift around lines 10 - 19, The
enum CherrishError should be explicitly exported: change the declaration of
CherrishError to be public so it can be used across the project (i.e., make the
type public by updating the declaration for enum CherrishError to include the
public access modifier while keeping its existing cases like DIFailedError,
decodingError, URLError, networkRequestFailed, networkConnect,
networkError(code:message:), noData, unknownError, and encodingError).

import OSLog

extension OSLog {
static let subsystem = Bundle.main.bundleIdentifier!
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

bundleIdentifier 강제 언래핑이 위험합니다.

Bundle.main.bundleIdentifier!는 유닛 테스트나 특정 환경에서 크래시를 발생시킬 수 있습니다.

🔒 제안하는 수정
-    static let subsystem = Bundle.main.bundleIdentifier!
+    static let subsystem = Bundle.main.bundleIdentifier ?? "com.cherrish.unknown"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
static let subsystem = Bundle.main.bundleIdentifier!
static let subsystem = Bundle.main.bundleIdentifier ?? "com.cherrish.unknown"
🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift at line 11, The forced
unwrap of Bundle.main.bundleIdentifier in the static let subsystem constant is
unsafe and can crash in tests or certain environments; change the initializer
for subsystem in CherrishLogger (static let subsystem) to handle the optional
safely — e.g., use nil-coalescing to a sensible default identifier or fallback
to another safe source (Bundle.main.object(forInfoDictionaryKey:
"CFBundleIdentifier") as? String ?? "com.cherrish.unknown"), or compute it
lazily and guard-fail with a default, so no forced unwrap remains.

Comment on lines +147 to +153
static func error(
_ error: Error,
file: String = #file,
function: String = #function
) {
log(type: .error(error: error), message: "", file: file, function: function)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

error 함수의 message 파라미터 사용을 고려하세요.

현재 error 함수는 빈 문자열("")을 message로 전달하고, 내부적으로 error.localizedDescription만 로깅합니다. 추가 컨텍스트 메시지를 함께 기록할 수 있도록 파라미터를 확장하는 것을 고려해보세요.

♻️ 제안하는 수정
     static func error(
         _ error: Error,
+        message: Any = "",
         file: String = #file,
         function: String = #function
     ) {
-        log(type: .error(error: error), message: "", file: file, function: function)
+        log(type: .error(error: error), message: message, file: file, function: function)
     }

그리고 log 함수 내 error 케이스에서:

         case .error(let error):
-            logger.error("[❌ Error] [Date: \(timestamp)] [\(fileName) -> \(function)]: \(error.localizedDescription)")
+            let contextMessage = logMessage.isEmpty ? "" : "[\(logMessage)] "
+            logger.error("[❌ Error] [Date: \(timestamp)] [\(fileName) -> \(function)]: \(contextMessage)\(error.localizedDescription)")

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift around lines 147 - 153,
Change the static func error to accept an optional message parameter (e.g.,
message: String = "") and pass that message into the existing log call instead
of the empty string; update the log handling for the .error(error: Error) case
inside log(...) to include and format both the provided message and
error.localizedDescription (so the log output shows the custom context message
plus the error details). Ensure you update the signature of CherrishLogger.error
and the .error case handling code paths that construct the final log string.

Copy link
Contributor

@soseoyo12 soseoyo12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다~~ Cool해요!!

Copy link
Contributor

@wotjs020708 wotjs020708 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

프레임 워크로 모듈화를 하신 거 맞나요?

@y-eonee
Copy link
Contributor Author

y-eonee commented Jan 8, 2026

프레임 워크로 모듈화를 하신 거 맞나요?

아뇨 모듈화 안했습니당

Copy link
Contributor

@sum130 sum130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

멋져요 잘 로그 찍어보겠슴미다!!

@y-eonee y-eonee merged commit 548f44b into develop Jan 8, 2026
1 check passed
@y-eonee y-eonee deleted the setting/#9-logger branch January 8, 2026 08:43
Kimgyuilli pushed a commit that referenced this pull request Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Setting 프로젝트 세팅 시 사용 나연🐹

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Setting] Logger

4 participants